Solving trigonometry equations